/*! \file Publisher.h holds the publisher functionality for the IR events */
#ifndef __PUBLISHER_H_INCLUDED__
#define __PUBLISHER_H_INCLUDED__

#define WIN32_LEAN_AND_MEAN

#include <boost/function.hpp>
#include <boost/thread.hpp>
#include <windows.h>
#include <map>
#include <boost/shared_ptr.hpp>

/*! \brief the function signature of the callback. 
 *  Note as this library develops it is likely this will change 
 */
typedef boost::function<void ( DWORD, DWORD, DWORD, const char * name )> IrCallback ;

class Publisher {
protected:
	typedef std::map<int, IrCallback> RegMap;
	RegMap m_Listeners;
	int m_Id;
	boost::mutex m_Mutex;
public:
	Publisher();
	~Publisher();
	int add ( IrCallback f );
	void remove ( int id );
	void call ( DWORD protocol, DWORD key, DWORD repeat, const char * name );
};
typedef boost::shared_ptr<Publisher> PublisherPtr;

#endif